public class Solution5 {
    public int[] singleNumber(int[] nums) {
        int[] ret = new int[2];
        int count = 0;
        for(int i = 0; i < nums.length; i++) {
            count = count ^ nums[i];
        }
        int lowbit = count & (-count);
        for(int i = 0; i < nums.length; i++) {
            if((lowbit & nums[i]) == 0) {
                ret[0] ^= nums[i];
            }else {
                ret[1] ^= nums[i];
            }
        }
        return ret;
    }
}
